/**
 * 
 */
package com.seascape.swms.system.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.seascape.swms.framework.model.Result;
import com.seascape.swms.framework.service.BaseService;
import com.seascape.swms.framework.web.BaseController;
import com.seascape.swms.system.model.Resource;
import com.seascape.swms.system.service.ResourceService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author Lay
 *
 */
@Api("资源接口")
@RestController
@RequestMapping("/resources")
public class ResourceController extends BaseController<Resource>{

	@Autowired
	private ResourceService resourceService;

	/* (non-Javadoc)
	 * @see com.seascape.swms.framework.util.BaseController#getBaseService()
	 */
	@Override
	protected BaseService<Resource> getBaseService() {
		return resourceService;
	}
	
	@ApiOperation("查询菜单")
	@GetMapping("/menu")
	public Result menu() {
		return Result.success(resourceService.queryResourcesByCurrentUser());
	}
	
	@ApiOperation("按角色代码查询资源")
	@GetMapping("/queryResourcesByRoleId")
	public Result queryResourcesByRoleId(Integer roleId) {
		return Result.success(resourceService.queryResourcesByRoleId(roleId));
	}
}
